namespace Wilco.CodeHilighter.Engine.SyntaxHighlighting
{
    using System;
    using System.Collections.ObjectModel;

    /// <summary>
    /// Represents a collection of highlighters.
    /// </summary>
    public class HighlighterCollection : Collection<HighlighterBase>
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of a <see cref="Wilco.CodeHilighter.Engine.SyntaxHighlighting.HighlighterCollection"/> class.
        /// </summary>
        public HighlighterCollection()
        {
            //
        }

        #endregion Constructors

        #region Indexers

        /// <summary>
        /// Gets the highlighter with the specified name.
        /// </summary>
        public HighlighterBase this[string name]
        {
            get
            {
                HighlighterBase highlighter = null;
                for (int i = 0; i < this.Items.Count; i++)
                {
                    highlighter = (HighlighterBase)this.Items[i];
                    if (highlighter.Name.ToLower() == name.ToLower())
                        return highlighter;
                }
                return null;
            }
        }

        #endregion Indexers
    }
}